home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 June / PersonalComputerWorld-June2009-CoverdiscCD.iso / Software / Shareware / Mockups for Desktop 1.5.27 / MockupsForDesktop.air / MockupsAir.swf / scripts / ConfirmationDialog.as < prev    next >
Encoding:
Text File  |  2009-03-03  |  8.3 KB  |  261 lines

  1. package
  2. {
  3.    import com.plus9.mockups.InputManager;
  4.    import com.plus9.mockups.dialogs.BaseDialog;
  5.    import flash.accessibility.*;
  6.    import flash.data.*;
  7.    import flash.debugger.*;
  8.    import flash.desktop.*;
  9.    import flash.display.*;
  10.    import flash.errors.*;
  11.    import flash.events.*;
  12.    import flash.external.*;
  13.    import flash.filesystem.*;
  14.    import flash.filters.*;
  15.    import flash.geom.*;
  16.    import flash.html.*;
  17.    import flash.html.script.*;
  18.    import flash.media.*;
  19.    import flash.net.*;
  20.    import flash.printing.*;
  21.    import flash.profiler.*;
  22.    import flash.system.*;
  23.    import flash.text.*;
  24.    import flash.ui.*;
  25.    import flash.utils.*;
  26.    import flash.xml.*;
  27.    import mx.binding.*;
  28.    import mx.containers.Canvas;
  29.    import mx.containers.ControlBar;
  30.    import mx.controls.Button;
  31.    import mx.controls.Text;
  32.    import mx.core.UIComponentDescriptor;
  33.    import mx.core.mx_internal;
  34.    import mx.events.PropertyChangeEvent;
  35.    import mx.styles.*;
  36.    
  37.    use namespace mx_internal;
  38.    
  39.    public class ConfirmationDialog extends BaseDialog implements IBindingClient
  40.    {
  41.       private static var _watcherSetupUtil:IWatcherSetupUtil;
  42.       
  43.       mx_internal var _bindingsByDestination:Object;
  44.       
  45.       mx_internal var _bindingsBeginWithWord:Object;
  46.       
  47.       private var _13255152dialogTitle:String;
  48.       
  49.       mx_internal var _watchers:Array;
  50.       
  51.       private var _94843_ok:Button;
  52.       
  53.       public var _ConfirmationDialog_Text1:Text;
  54.       
  55.       mx_internal var _bindings:Array;
  56.       
  57.       private var _documentDescriptor_:UIComponentDescriptor;
  58.       
  59.       private var _954925063message:String;
  60.       
  61.       public function ConfirmationDialog()
  62.       {
  63.          _documentDescriptor_ = new UIComponentDescriptor({
  64.             "type":BaseDialog,
  65.             "propertiesFactory":function():Object
  66.             {
  67.                return {
  68.                   "width":396,
  69.                   "height":226,
  70.                   "childDescriptors":[new UIComponentDescriptor({
  71.                      "type":Canvas,
  72.                      "stylesFactory":function():void
  73.                      {
  74.                         this.right = "10";
  75.                         this.bottom = "10";
  76.                         this.left = "10";
  77.                         this.top = "10";
  78.                      },
  79.                      "propertiesFactory":function():Object
  80.                      {
  81.                         return {"childDescriptors":[new UIComponentDescriptor({
  82.                            "type":Text,
  83.                            "id":"_ConfirmationDialog_Text1",
  84.                            "propertiesFactory":function():Object
  85.                            {
  86.                               return {
  87.                                  "width":336,
  88.                                  "selectable":true
  89.                               };
  90.                            }
  91.                         })]};
  92.                      }
  93.                   }),new UIComponentDescriptor({
  94.                      "type":ControlBar,
  95.                      "stylesFactory":function():void
  96.                      {
  97.                         this.horizontalAlign = "center";
  98.                      },
  99.                      "propertiesFactory":function():Object
  100.                      {
  101.                         return {"childDescriptors":[new UIComponentDescriptor({
  102.                            "type":Button,
  103.                            "id":"_ok",
  104.                            "events":{"click":"___ok_click"},
  105.                            "propertiesFactory":function():Object
  106.                            {
  107.                               return {"label":"OK"};
  108.                            }
  109.                         })]};
  110.                      }
  111.                   })]
  112.                };
  113.             }
  114.          });
  115.          mx_internal::_bindings = [];
  116.          mx_internal::_watchers = [];
  117.          mx_internal::_bindingsByDestination = {};
  118.          mx_internal::_bindingsBeginWithWord = {};
  119.          super();
  120.          mx_internal::_document = this;
  121.          this.width = 396;
  122.          this.height = 226;
  123.       }
  124.       
  125.       public static function set watcherSetupUtil(param1:IWatcherSetupUtil) : void
  126.       {
  127.          ConfirmationDialog._watcherSetupUtil = param1;
  128.       }
  129.       
  130.       public function set _ok(param1:Button) : void
  131.       {
  132.          var _loc2_:Object = this._94843_ok;
  133.          if(_loc2_ !== param1)
  134.          {
  135.             this._94843_ok = param1;
  136.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_ok",_loc2_,param1));
  137.          }
  138.       }
  139.       
  140.       [Bindable(event="propertyChange")]
  141.       public function get message() : String
  142.       {
  143.          return this._954925063message;
  144.       }
  145.       
  146.       public function set message(param1:String) : void
  147.       {
  148.          var _loc2_:Object = this._954925063message;
  149.          if(_loc2_ !== param1)
  150.          {
  151.             this._954925063message = param1;
  152.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"message",_loc2_,param1));
  153.          }
  154.       }
  155.       
  156.       override public function initialize() : void
  157.       {
  158.          var bindings:Array;
  159.          var watchers:Array;
  160.          var i:uint;
  161.          var target:ConfirmationDialog = null;
  162.          var watcherSetupUtilClass:Object = null;
  163.          mx_internal::setDocumentDescriptor(_documentDescriptor_);
  164.          bindings = _ConfirmationDialog_bindingsSetup();
  165.          watchers = [];
  166.          target = this;
  167.          if(_watcherSetupUtil == null)
  168.          {
  169.             watcherSetupUtilClass = getDefinitionByName("_ConfirmationDialogWatcherSetupUtil");
  170.             watcherSetupUtilClass["init"](null);
  171.          }
  172.          _watcherSetupUtil.setup(this,function(param1:String):*
  173.          {
  174.             return target[param1];
  175.          },bindings,watchers);
  176.          i = 0;
  177.          while(i < bindings.length)
  178.          {
  179.             Binding(bindings[i]).execute();
  180.             i++;
  181.          }
  182.          mx_internal::_bindings = mx_internal::_bindings.concat(bindings);
  183.          mx_internal::_watchers = mx_internal::_watchers.concat(watchers);
  184.          super.initialize();
  185.       }
  186.       
  187.       override public function closeYourself() : void
  188.       {
  189.          super.closeYourself();
  190.          _ok.removeEventListener(MouseEvent.CLICK,onCancel);
  191.       }
  192.       
  193.       private function _ConfirmationDialog_bindingExprs() : void
  194.       {
  195.          var _loc1_:* = undefined;
  196.          _loc1_ = dialogTitle;
  197.          _loc1_ = message;
  198.       }
  199.       
  200.       [Bindable(event="propertyChange")]
  201.       public function get _ok() : Button
  202.       {
  203.          return this._94843_ok;
  204.       }
  205.       
  206.       public function set dialogTitle(param1:String) : void
  207.       {
  208.          var _loc2_:Object = this._13255152dialogTitle;
  209.          if(_loc2_ !== param1)
  210.          {
  211.             this._13255152dialogTitle = param1;
  212.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"dialogTitle",_loc2_,param1));
  213.          }
  214.       }
  215.       
  216.       public function ___ok_click(param1:MouseEvent) : void
  217.       {
  218.          onCancel();
  219.       }
  220.       
  221.       override public function init(param1:InputManager) : void
  222.       {
  223.          super.init(param1);
  224.          defaultButton = _ok;
  225.          _ok.setFocus();
  226.       }
  227.       
  228.       [Bindable(event="propertyChange")]
  229.       public function get dialogTitle() : String
  230.       {
  231.          return this._13255152dialogTitle;
  232.       }
  233.       
  234.       private function _ConfirmationDialog_bindingsSetup() : Array
  235.       {
  236.          var binding:Binding = null;
  237.          var result:Array = [];
  238.          binding = new Binding(this,function():String
  239.          {
  240.             var _loc1_:* = dialogTitle;
  241.             return _loc1_ == undefined ? null : String(_loc1_);
  242.          },function(param1:String):void
  243.          {
  244.             this.title = param1;
  245.          },"this.title");
  246.          result[0] = binding;
  247.          binding = new Binding(this,function():String
  248.          {
  249.             var _loc1_:* = message;
  250.             return _loc1_ == undefined ? null : String(_loc1_);
  251.          },function(param1:String):void
  252.          {
  253.             _ConfirmationDialog_Text1.text = param1;
  254.          },"_ConfirmationDialog_Text1.text");
  255.          result[1] = binding;
  256.          return result;
  257.       }
  258.    }
  259. }
  260.  
  261.